from django.db import models
from django.contrib.auth.models import AbstractUser


class UserProfile(AbstractUser):
    # 自增字段
    uid = models.AutoField(primary_key=True)
    username = models.CharField(max_length=30, unique=True)
    # USERNAME_FIELD是必需的，它是设置认证标识。设置成标识的字段unique必须为True。
    USERNAME_FIELD = 'username'
    GENDER_CHOICE = (
        (u'M', u'Male'),
        (u'F', u'Female'),
    )
    gender = models.CharField(max_length=2, choices=GENDER_CHOICE)
    phone = models.CharField(max_length=11, unique=True, null=True, blank=True)
    mod_date = models.DateTimeField(auto_now=True)

    class Meta:
        verbose_name = 'User'
        ordering = ['-uid', ]




